#include <iostream>
#include <string>

using namespace std;

struct stu
{
public:
    string name;
    int id;

public:
    // 少了无参构造
    stu() {}
    stu(string name, int id)
        : name(name), id(id)
    {
        
    }
};

ostream& operator<<(ostream& os, const stu& c)
{
    os << "姓名" << c.name << "\t学号" << c.id ;
    return os;  // 返回流对象以支持链式操作
}


template <class Element_type>
class list
{
private:
    Element_type data[50];
    int len;

public:
    // 构造
    list()
    {
        len = 0;
    }
    // 析构
    ~list()
    {
    }

public:
    // 增  尾增
    void push_back(Element_type data)
    {
        this->data[len] = data;
        len++;
    }
    // 删  尾增
    void pop_back()
    {
        len--;
    }

    // 遍历
    void print_list()
    {
        for (size_t i = 0; i < len; i++)
        {
            cout << data[i] << endl;
        }
    }
};

int main(int argc, char const *argv[])
{
    list<stu> L;

    L.push_back(stu("唐三", 1));
    L.push_back(stu("肖炎", 2));
    L.push_back(stu("张三", 3));
    L.push_back(stu("李四", 4));

    L.print_list();

    return 0;
}
